package com.ruiysoft.crm.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruiysoft.crm.mapper.BizSmsMapper;
import com.ruiysoft.crm.model.entity.BizCallLog;
import com.ruiysoft.crm.model.entity.BizSms;
import com.ruiysoft.crm.service.BizSmsService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author lumiing
 */
@Service
public class BizSmsServiceImpl extends ServiceImpl<BizSmsMapper, BizSms> implements BizSmsService {
    private final BizSmsMapper bizSmsMapper;

    public BizSmsServiceImpl(BizSmsMapper bizSmsMapper) {
        this.bizSmsMapper = bizSmsMapper;
    }

    @Override
    public Page getSMS(Map<String, Object> params, int userId) {
        int current= Integer.parseInt((String)params.get("current"));
        int pageSize= Integer.parseInt((String)params.get("pageSize"));
        String clientid= ((String)params.get("clientid"));
        params.remove("current");
        params.remove("pageSize");
        params.put("userid",userId);
        Page<BizCallLog> page = new Page<BizCallLog>(current, pageSize);
        page.setDesc("createDate");
       /* String one= (String) params. get("one");
        if("1".equals(one)){ //查询个人的
            params.put("createId",userId);
        }
        params.remove("one");*/
        page.setRecords(bizSmsMapper.getSMS(page,params));
        return page;
    }
}